Abstract
Mi resumenProfesor: Jose Ramon Martinez Batlle.
En este tema de Vecindad y Autocorrealcion, analisaremos que tanto se correlacion las personas de los municipios con su entorno con sus vecinos mas cercanos y que tanto incide nuestra variable dependiente analizada cuanto hay contiguidad. podremos mirar que pasa con la dlincuencia en el pais a la falta de alternativas sana para el entretenimiento como esto puede contagia a los municipios vecinos hasta la posibilidad de convertirse en una epidemia local. a nivel espacial. evaluaremos si hay efectos de contagio o si son casos que solo se concentran en un municipo y no se extienden a los demas. ‘A que cree que se debe la delincuencia en el pais ¿A la falta de alternativas sanas (clubes, cine, teatro, etc.) para el entretenimiento?: Si’
En este proyecto Realizaremos el análisis exploratorio de datos espaciales, funciones de homogeneidad espacial, tipos de vecindad, ponderadores y con el índice de autocorrelación espacial de Moran.
Usaremos como referencia la capa de provincias dominicanas y los resultados de la Encuesta Nacional de Hogares de Propósitos Múltiples de 2017 (ENHOGAR-2017, de. Te usaremos la pregunta de investigacion, sobre la cual sera realizado el análisis de autocorrelación al final.
sf, la colección tidyverse y los paquetes spdep, lmtest, tmap y RColorBrewerlibrary(sf)
## Linking to GEOS 3.7.1, GDAL 2.4.2, PROJ 5.2.0
library(tidyverse)
## ── Attaching packages ───────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.1 ✔ purrr 0.3.3
## ✔ tibble 2.1.3 ✔ dplyr 0.8.3
## ✔ tidyr 1.0.0 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(spdep)
## Loading required package: sp
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(tmap)
library(RColorBrewer)
.csv), asignándolo al objeto en17. Nota que “ENHOGAR 2017” es una encuesta y, por lo tanto, recoge resultados referidos a una muestra, cuyo tamaño por provincia está recogido en la columna muestra. Carga también la capa geométrica (.gpkg) asignándola al objeto prov, y se unira a en17. Revisaremos el problema de la inconsistencia en el código entre ambas fuentes.en17 <- read.csv('material-de-apoyo-master/data/enhogar_2017.csv', check.names = F)
prov <- st_read(dsn = 'material-de-apoyo-master/data/divisionRD.gpkg', layer = 'PROVcenso2010')
## Reading layer `PROVcenso2010' from data source `/home/franc/unidad-0-asignacion-99-mi-proyecto-Adalbertogp2020/material-de-apoyo-master/data/divisionRD.gpkg' using driver `GPKG'
## Simple feature collection with 32 features and 4 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 182215.8 ymin: 1933532 xmax: 571365.3 ymax: 2205216
## epsg (SRID): 32619
## proj4string: +proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
en17 <- en17 %>% mutate(ENLACE = ifelse(nchar(Código)==3, paste0('0', Código),Código))
match(en17$ENLACE, prov$ENLACE)
## [1] 9 18 25 13 24 28 6 14 19 20 5 15 26 27 2 17 21 31 3 4 10 16 7
## [24] 22 8 11 12 23 29 30 1 32
proven17 <- prov %>% inner_join(en17, by = 'ENLACE')
## Warning: Column `ENLACE` joining factor and character vector, coercing into
## character vector
sf resultante y genera un mapa que muestre tu pregunta para todo el país.proven17 %>%
dplyr::select(contains('A que cree que se debe la delincuencia en el pais ¿A la falta de alternativas sanas (clubes, cine, teatro, etc.) para el entretenimiento?: Si')) %>%
plot(breaks = 'jenks')
spproven17 a SpatialPolygonsDataFrame asignándolo a proven17.sp, mediante la función as_Spatial. Este paso es necesario para crear los objetos de vecindad. Verificamos que los nombres de columnas proven17.sp aparecen deformados (espacios sustituidos por puntos), y lo corrígimos rescatando los nombres del objeto original proven17.proven17.sp <- as_Spatial(proven17)
colnames(proven17.sp@data)[1:20]
## [1] "PROV"
## [2] "REG"
## [3] "TOPONIMIA"
## [4] "ENLACE"
## [5] "Código"
## [6] "Provincia"
## [7] "Principales.problemas.de.su.barrio.o.comunidad...La.falta.de.energía.eléctrica...Si"
## [8] "Principales.problemas.de.su.barrio.o.comunidad...La.falta.de.energía.eléctrica...No"
## [9] "Principales.problemas.de.su.barrio.o.comunidad...La.delincuencia...Si"
## [10] "Principales.problemas.de.su.barrio.o.comunidad...La.delincuencia...No"
## [11] "Principales.problemas.de.su.barrio.o.comunidad...El.desempleo...Si"
## [12] "Principales.problemas.de.su.barrio.o.comunidad...El.desempleo...No"
## [13] "Principales.problemas.de.su.barrio.o.comunidad...La.pobreza...Si"
## [14] "Principales.problemas.de.su.barrio.o.comunidad...La.pobreza...No"
## [15] "Principales.problemas.de.su.barrio.o.comunidad...El.consumo.de.drogas...Si"
## [16] "Principales.problemas.de.su.barrio.o.comunidad...El.consumo.de.drogas...No"
## [17] "Principales.problemas.de.su.barrio.o.comunidad...La.venta.de.drogas...Si"
## [18] "Principales.problemas.de.su.barrio.o.comunidad...La.venta.de.drogas...No"
## [19] "Principales.problemas.de.su.barrio.o.comunidad...El.costo.de.la.vida...Si"
## [20] "Principales.problemas.de.su.barrio.o.comunidad...El.costo.de.la.vida...No"
colnames(proven17.sp@data) <- proven17 %>% st_drop_geometry() %>% colnames
proven17.sp a partir de la columna TOPONIMIA.row.names(proven17.sp) <- as.character(proven17.sp$TOPONIMIA)
proven17.sp, creamos un objeto de vecindad por contigüidad, asignándolo a proven17.nb, usando criterio queen. Se Imprime en pantalla el resumen de dicho objeto de vecindad.proven17.nb <- poly2nb(proven17.sp, queen=TRUE)
summary(proven17.nb)
## Neighbour list object:
## Number of regions: 32
## Number of nonzero links: 144
## Percentage nonzero weights: 14.0625
## Average number of links: 4.5
## Link number distribution:
##
## 1 2 3 4 5 6 7 8 9
## 1 2 5 11 5 4 2 1 1
## 1 least connected region:
## DISTRITO NACIONAL with 1 link
## 1 most connected region:
## LA VEGA with 9 links
card(proven17.nb)
## [1] 1 6 4 4 3 7 4 4 6 5 2 3 9 3 4 2 3 4 3 4 5 7 5 4 6 6 4 5 8 4 5 4
sapply(proven17.nb, function(x) x)
## [[1]]
## [1] 32
##
## [[2]]
## [1] 3 4 13 17 22 31
##
## [[3]]
## [1] 2 4 10 22
##
## [[4]]
## [1] 2 3 10 16
##
## [[5]]
## [1] 7 15 26
##
## [[6]]
## [1] 9 13 14 19 20 24 29
##
## [[7]]
## [1] 5 10 22 26
##
## [[8]]
## [1] 11 12 23 30
##
## [[9]]
## [1] 6 13 14 18 19 25
##
## [[10]]
## [1] 3 4 7 16 22
##
## [[11]]
## [1] 8 12
##
## [[12]]
## [1] 8 11 23
##
## [[13]]
## [1] 2 6 9 19 22 24 25 28 31
##
## [[14]]
## [1] 6 9 20
##
## [[15]]
## [1] 5 18 26 27
##
## [[16]]
## [1] 4 10
##
## [[17]]
## [1] 2 21 31
##
## [[18]]
## [1] 9 15 25 27
##
## [[19]]
## [1] 6 9 13
##
## [[20]]
## [1] 6 14 29 30
##
## [[21]]
## [1] 17 28 29 31 32
##
## [[22]]
## [1] 2 3 7 10 13 25 26
##
## [[23]]
## [1] 8 12 29 30 32
##
## [[24]]
## [1] 6 13 28 29
##
## [[25]]
## [1] 9 13 18 22 26 27
##
## [[26]]
## [1] 5 7 15 22 25 27
##
## [[27]]
## [1] 15 18 25 26
##
## [[28]]
## [1] 13 21 24 29 31
##
## [[29]]
## [1] 6 20 21 23 24 28 30 32
##
## [[30]]
## [1] 8 20 23 29
##
## [[31]]
## [1] 2 13 17 21 28
##
## [[32]]
## [1] 1 21 23 29
plot(proven17.sp, border="grey", lwd=0.5)
plot(proven17.nb, coordinates(proven17.sp), add=T)
is.symmetric.nb(proven17.nb)
## [1] TRUE
proven17.sp, crearemos un objeto de vecindad por número de vecinos, en el que cada geometría tenga sólo un vecino, asignándolo a proven17.nb.k1. Imprime en pantalla el resumen de dicho objeto de vecindad. Recuerda crear un objeto de coordenadas de centroides, que en este ejercicio se sugiere con el nombre coords, y otro de identidades de cada geometría, para el cual se sugiere el nombre ident; en ambos los usamos dentro de la función knn2nb El resumen del objeto proven17.nb.k1 debe mostrar 32 vínculos, el mismo número de regiones de proven17.sp,coords <- coordinates(proven17.sp)
ident <- row.names(proven17.sp)
proven17.nb.k1 <- knn2nb(knearneigh(coords, k = 1), row.names = ident)
summary(proven17.nb.k1)
## Neighbour list object:
## Number of regions: 32
## Number of nonzero links: 32
## Percentage nonzero weights: 3.125
## Average number of links: 1
## Non-symmetric neighbours list
## Link number distribution:
##
## 1
## 32
## 32 least connected regions:
## DISTRITO NACIONAL AZUA BAORUCO BARAHONA DAJABÓN DUARTE ELÍAS PIÑA EL SEIBO ESPAILLAT INDEPENDENCIA LA ALTAGRACIA LA ROMANA LA VEGA MARÍA TRINIDAD SÁNCHEZ MONTE CRISTI PEDERNALES PERAVIA PUERTO PLATA HERMANAS MIRABAL SAMANÁ SAN CRISTÓBAL SAN JUAN SAN PEDRO DE MACORÍS SANCHEZ RAMÍREZ SANTIAGO SANTIAGO RODRÍGUEZ VALVERDE MONSEÑOR NOUEL MONTE PLATA HATO MAYOR SAN JOSÉ DE OCOA SANTO DOMINGO with 1 link
## 32 most connected regions:
## DISTRITO NACIONAL AZUA BAORUCO BARAHONA DAJABÓN DUARTE ELÍAS PIÑA EL SEIBO ESPAILLAT INDEPENDENCIA LA ALTAGRACIA LA ROMANA LA VEGA MARÍA TRINIDAD SÁNCHEZ MONTE CRISTI PEDERNALES PERAVIA PUERTO PLATA HERMANAS MIRABAL SAMANÁ SAN CRISTÓBAL SAN JUAN SAN PEDRO DE MACORÍS SANCHEZ RAMÍREZ SANTIAGO SANTIAGO RODRÍGUEZ VALVERDE MONSEÑOR NOUEL MONTE PLATA HATO MAYOR SAN JOSÉ DE OCOA SANTO DOMINGO with 1 link
1.card(proven17.nb)
## [1] 1 6 4 4 3 7 4 4 6 5 2 3 9 3 4 2 3 4 3 4 5 7 5 4 6 6 4 5 8 4 5 4
sapply(proven17.nb, function(x) x)
## [[1]]
## [1] 32
##
## [[2]]
## [1] 3 4 13 17 22 31
##
## [[3]]
## [1] 2 4 10 22
##
## [[4]]
## [1] 2 3 10 16
##
## [[5]]
## [1] 7 15 26
##
## [[6]]
## [1] 9 13 14 19 20 24 29
##
## [[7]]
## [1] 5 10 22 26
##
## [[8]]
## [1] 11 12 23 30
##
## [[9]]
## [1] 6 13 14 18 19 25
##
## [[10]]
## [1] 3 4 7 16 22
##
## [[11]]
## [1] 8 12
##
## [[12]]
## [1] 8 11 23
##
## [[13]]
## [1] 2 6 9 19 22 24 25 28 31
##
## [[14]]
## [1] 6 9 20
##
## [[15]]
## [1] 5 18 26 27
##
## [[16]]
## [1] 4 10
##
## [[17]]
## [1] 2 21 31
##
## [[18]]
## [1] 9 15 25 27
##
## [[19]]
## [1] 6 9 13
##
## [[20]]
## [1] 6 14 29 30
##
## [[21]]
## [1] 17 28 29 31 32
##
## [[22]]
## [1] 2 3 7 10 13 25 26
##
## [[23]]
## [1] 8 12 29 30 32
##
## [[24]]
## [1] 6 13 28 29
##
## [[25]]
## [1] 9 13 18 22 26 27
##
## [[26]]
## [1] 5 7 15 22 25 27
##
## [[27]]
## [1] 15 18 25 26
##
## [[28]]
## [1] 13 21 24 29 31
##
## [[29]]
## [1] 6 20 21 23 24 28 30 32
##
## [[30]]
## [1] 8 20 23 29
##
## [[31]]
## [1] 2 13 17 21 28
##
## [[32]]
## [1] 1 21 23 29
plot), y luego le superpondremos el mapa de los vínculos (segunda corrida de plot, con el argumento add=T)plot(proven17.sp, border="grey", lwd=0.5)
plot(proven17.nb.k1, coordinates(proven17.sp), add=T)
is.symmetric.nb(proven17.nb)
## [1] TRUE
proven17.nb.k1. Para esto, creamos un objeto denominado dist donde se almacenan las distancias a partir de aplicar la función nbdists (recordar colocar el objeto coords). Esta funcion Imprime en pantalla un resumen estadístico, y genera un histograma y un boxplot.dist <- unlist(nbdists(proven17.nb.k1, coords))
summary(dist)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 13343 27259 31411 29957 34552 41826
hist(dist)
boxplot(dist)
distmin usando la función min) y otro con la máxima (objeto distmax usando la función max). y las asígnamos a los objetos indicemin y indicemax. Luego, utiliza dichas posiciones (indicemin y indicemax) dentro del índice de ident para determinar cuál o cuáles provincias se encuentran a la menor y a la mayor distancia en el conjunto del país.(distmin <- min(dist))
## [1] 13343.28
(distmax <- max(dist))
## [1] 41826.21
indicemin <- which(dist==distmin)
ident[indicemin]
## [1] "DISTRITO NACIONAL" "SANTO DOMINGO"
indicemax <- which(dist==distmax)
ident[indicemax]
## [1] "SAMANÁ"
ident[order(dist)]
## [1] "DISTRITO NACIONAL" "SANTO DOMINGO"
## [3] "ESPAILLAT" "HERMANAS MIRABAL"
## [5] "DUARTE" "MARÍA TRINIDAD SÁNCHEZ"
## [7] "PERAVIA" "SAN CRISTÓBAL"
## [9] "SANCHEZ RAMÍREZ" "LA VEGA"
## [11] "MONSEÑOR NOUEL" "DAJABÓN"
## [13] "SANTIAGO RODRÍGUEZ" "MONTE PLATA"
## [15] "PUERTO PLATA" "VALVERDE"
## [17] "BAORUCO" "INDEPENDENCIA"
## [19] "SANTIAGO" "SAN JOSÉ DE OCOA"
## [21] "LA ALTAGRACIA" "LA ROMANA"
## [23] "EL SEIBO" "HATO MAYOR"
## [25] "SAN PEDRO DE MACORÍS" "MONTE CRISTI"
## [27] "AZUA" "ELÍAS PIÑA"
## [29] "SAN JUAN" "BARAHONA"
## [31] "PEDERNALES" "SAMANÁ"
proven17.w.W) y otro binario, luego lo asignamos a proven17.w.B)proven17.w.W <- nb2listw(proven17.nb)
proven17.w.W
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 32
## Number of nonzero links: 144
## Percentage nonzero weights: 14.0625
## Average number of links: 4.5
##
## Weights style: W
## Weights constants summary:
## n nn S0 S1 S2
## W 32 1024 32 15.83669 132.7525
proven17.w.B <- nb2listw(proven17.nb, style = 'B')
proven17.w.B
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 32
## Number of nonzero links: 144
## Percentage nonzero weights: 14.0625
## Average number of links: 4.5
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 32 1024 144 288 2968
Exploramos la autocorrelación espacial de nuestra variable utilizando el I de Moran global y el local.
*Con la funcion tidyverse, generamos una columna de porcentaje de personas que respondió a nuestra pregunta, respecto del tamaño de la muestra a nivel provincial (columna muestra). le Pondremos por nombre mivariable_pct. luego Haremos una transformada a partir de la anterior, y le pondremos el nombre mivariable_pct_log. El objeto sf resultante se asígnara a proven17_mivar_sf
mivariable <- 'A qué cree que se debe la delincuencia en el país: ¿A la falta de alternativas sanas (clubes, cine, teatro, etc.) para el entretenimiento?: Si'
proven17_mivar <- proven17 %>%
st_centroid() %>%
select(ENLACE, mivariable=contains(mivariable), muestra) %>%
mutate('mivariable_pct' = mivariable/muestra*100,
'mivariable_pct_log' = log1p(mivariable/muestra*100),
x=unlist(map(geom,1)),
y=unlist(map(geom,2))) %>%
select(-muestra) %>%
st_drop_geometry()
## Warning in st_centroid.sf(.): st_centroid assumes attributes are constant
## over geometries of x
proven17_mivar_sf <- proven17 %>%
inner_join(proven17_mivar, by = 'ENLACE') %>%
dplyr::select(muestra, contains('mivariable'), x, y, ENLACE, TOPONIMIA)
p1 <- tm_shape(proven17_mivar_sf) +
tm_fill(col = "mivariable_pct", style = 'jenks',
palette = brewer.pal(9, name = 'Reds'), title = mivariable) +
tm_borders(lwd = 0.5)
p2 <- tm_shape(proven17_mivar_sf) +
tm_fill(col = "mivariable_pct_log", style = 'jenks',
palette = brewer.pal(9, name = 'Reds'), midpoint = NA, title = mivariable) +
tm_borders(lwd = 0.5)
tmap_arrange(p1, p2)
qqnorm(proven17_mivar_sf$mivariable_pct) #Versión original de la variable
shapiro.test(proven17_mivar_sf$mivariable_pct) #Versión original de la variable
##
## Shapiro-Wilk normality test
##
## data: proven17_mivar_sf$mivariable_pct
## W = 0.86785, p-value = 0.001036
qqnorm(proven17_mivar_sf$mivariable_pct_log) #Versión transformada de la variable (log)
shapiro.test(proven17_mivar_sf$mivariable_pct_log) #Versión transformada de la variable (log)
##
## Shapiro-Wilk normality test
##
## data: proven17_mivar_sf$mivariable_pct_log
## W = 0.98533, p-value = 0.9311
1-Para la variable original=prueba de Shapiro-Wilk resulta significativa (es decir, el valor de p menor que 0.05), entonces se asume como no válido el supuesto de normalidad.
2-Para la variable modificada=prueba de Shaprio-Wilk resulta no significativa (es decir, el valor de pmayor que 0.05), entonces se asume como válido el supuesto de normalidad.
x e y, tanto en su versión original como en la transformada, mediante la prueba de Breusch-Pagan.proven17_mivar_sf %>% lm(mivariable_pct ~ x, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 0.26322, df = 1, p-value = 0.6079
proven17_mivar_sf %>% lm(mivariable_pct ~ y, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 3.8733, df = 1, p-value = 0.04906
proven17_mivar_sf %>% lm(mivariable_pct_log ~ x, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 0.0025367, df = 1, p-value = 0.9598
proven17_mivar_sf %>% lm(mivariable_pct_log ~ y, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 5.4309, df = 1, p-value = 0.01978
1-Para la variable original=el valor de p es mayor que 0.05 (nivel de significancia no convencional, aunque arbitrario), no existe evidencia para rechazar la hipótesis de homocedasticidad.
2-Para la variable modificada=el valor de p es mayor que 0.05 (nivel de significancia no convencional, aunque arbitrario), no existe evidencia para rechazar la hipótesis de homocedasticidad.
En la eventualidad de que el supuesto normalidad y el de homocedasticidad no se cumplan, continúa con el procedimiento de estimar la autocorrelación la versión original o la transformada de tu variable, según elijas, aun cuando los resultados del análisis de autocorrelación espacial podrían no ser fiables.
match(attr(proven17.w.W$neighbours, "region.id"), proven17_mivar_sf$TOPONIMIA)==1:32
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [15] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [29] TRUE TRUE TRUE TRUE
(gmoranw <- moran.test(x = proven17_mivar_sf$mivariable_pct_log, listw = proven17.w.W))
##
## Moran I test under randomisation
##
## data: proven17_mivar_sf$mivariable_pct_log
## weights: proven17.w.W
##
## Moran I statistic standard deviate = 2.2906, p-value = 0.01099
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic Expectation Variance
## 0.23185848 -0.03225806 0.01329463
(gmoranb <- moran.test(x = proven17_mivar_sf$mivariable_pct_log, listw = proven17.w.B))
##
## Moran I test under randomisation
##
## data: proven17_mivar_sf$mivariable_pct_log
## weights: proven17.w.B
##
## Moran I statistic standard deviate = 2.119, p-value = 0.01705
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic Expectation Variance
## 0.19297774 -0.03225806 0.01129866
1-Para los pesos estandarizados=el valor de p obtenido fue menor de 0.05, hay evidencia preliminar para rechazar la hipótesis nula de “no hay autocorrelación espacial”, y por lo tanto concluir que “si hay autocorrelación espacial”
2-Para los pesos binarios=el valor de p obtenido fue menor de 0.05, hay evidencia preliminar para rechazar la hipótesis nula de “no hay autocorrelación espacial”, y por lo tanto concluir que “si hay autocorrelación espacial”
moran.plot. Posteriormente, cargamos el script lisaclusters.R, y ejecutamos la función lisamap a nuestros datos para generar el mapa LISA. En la función lisamap, debemos introducir los siguientes argumentos: objesp, que es el objeto espacial denominado proven17_mivar_sf; pesos, que es el objeto de pesos, que será proven17.w.W.moran.plot(x = proven17_mivar_sf$mivariable_pct_log, listw = proven17.w.W)
source('lisaclusters.R')
lisamap(objesp = proven17_mivar_sf,
var = 'mivariable_pct_log',
pesos = proven17.w.W,
tituloleyenda = 'Significancia\n("x-y", léase\ncomo "x"\nrodeado de "y"',
leyenda = T,
anchuratitulo = 1000,
tamanotitulo = 16,
fuentedatos = 'ENHOGAR 2017',
titulomapa = paste0('Clusters LISA de respuestas a la pregunta:\n"', mivariable, '"'))
## $grafico
##
## $objeto
## Simple feature collection with 32 features and 11 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 182215.8 ymin: 1933532 xmax: 571365.3 ymax: 2205216
## epsg (SRID): 32619
## proj4string: +proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
## First 10 features:
## muestra mivariable mivariable_pct mivariable_pct_log x y
## 1 4146 173 4.172697 1.6433941 400578.3 2044093
## 2 757 9 1.188904 0.7834008 306538.2 2055500
## 3 343 5 1.457726 0.8992365 253648.9 2048423
## 4 688 12 1.744186 1.0094845 265654.1 2010069
## 5 252 3 1.190476 0.7841190 226729.0 2151498
## 6 1198 21 1.752922 1.0126627 386306.5 2129851
## 7 198 6 3.030303 1.3938416 225124.2 2102815
## 8 325 5 1.538462 0.9315582 495201.2 2080870
## 9 815 11 1.349693 0.8542848 353886.4 2160683
## 10 201 3 1.492537 0.9133012 223355.0 2038578
## ENLACE TOPONIMIA geom puntuacionz
## 1 1001 DISTRITO NACIONAL MULTIPOLYGON (((406845.9 20... 1.47572306
## 2 0502 AZUA MULTIPOLYGON (((322129.5 20... -0.38594119
## 3 0603 BAORUCO MULTIPOLYGON (((271940 2060... -0.13518662
## 4 0604 BARAHONA MULTIPOLYGON (((291856.5 20... 0.10347191
## 5 0405 DAJABÓN MULTIPOLYGON (((245433.3 21... -0.38438648
## 6 0306 DUARTE MULTIPOLYGON (((374434.8 21... 0.11035193
## 7 0707 ELÍAS PIÑA MULTIPOLYGON (((235630.8 21... 0.93550600
## 8 0808 EL SEIBO MULTIPOLYGON (((523436.4 20... -0.06521847
## 9 0109 ESPAILLAT MULTIPOLYGON (((385993.5 21... -0.23249553
## 10 0610 INDEPENDENCIA MULTIPOLYGON (((205698.2 20... -0.10474020
## lagpuntuacionz quad_sig
## 1 1.23048642 high-high
## 2 0.11418625 not signif.
## 3 -0.24811897 not signif.
## 4 -0.67691755 not signif.
## 5 -0.44526640 not signif.
## 6 0.08905067 not signif.
## 7 -0.59504145 not signif.
## 8 -0.06880244 not signif.
## 9 -0.22423955 not signif.
## 10 -0.35665546 not signif.
1-Hay un patron de relleno rojo y azul significa que existe autocorrelación local
2-Hay Un patrón de varias provincias coloreadas de rojo se atribuye a “efecto de contagio” importante. esto siginifica que hay autocorrelación espacial local
3-En las demas provincias se observa el gris siginifica que no hay autocorrelación espacial local
Atraves de este procedimientos pudimos verificar que la delicuencia en el pais se puede contagiar a varias provincias vecinas y que influye mucho en el crecimiento de la delincuencia la faltas de alternativas sanas como son clubes, cine , teatro etc. para el entretenimiento. atraves de la ejecucion del codigo pudimos darmos cuenta que el mismo tenia una distribucion normal en la variable modificada. mediante la prueva de Shapiro-Wilk, Breusch-Pagan y I de moran pudimos establecer los criterios para cada prueba descritos mas arriba. tambien pudimos demostrar que existe autocorrelacion espacial local y efecto de contagio importante.
Codigos, procedimientos de la clase de Vecindad y autocorrelacion espacial del profesor Jose Ramon Martinez Batlle.
Material de apoyo, suministrado por el profesor Jose Ramon Martinez Batlle. Capa de division de Provincia de La ONE. (Oficina Nacional de Estadisticas) Encuesta En hogar de la ONE.(Oficina Nacional de Estadisticas) Capa de ProvCenso2010 de la ONE.(Oficina Nacional de Estadisticas)
El presente proyecto se trata de generar una superficie continua y atraves de ella crear un mapa de isoyetas, para esto utilizaremos la capa de provincias de la OFICINA NACIONAL DE ESTADISTICA (ONE) y los datos de lluvia de la OFICINA NACIONAL DE METEOROLOGIA (ONAMET) los datos de lluvia corresponden al año 1998, año en el cual fuimos golpeados por un fenomeno meteorologico muy fuerte qeu causo muchos daños al pais, causo inundaciones en casi en todo el territorio nacional asi como grandes areas de bosques y cutivos debastadas, debido a sus fuertes vientos. el nombre de este fenomeno es el Ciclon GEORGE. en el pais ocurrieron muchas lluvias durante casi todo el año 1998.es por esta razon nuestro interes de realizar el analisis para este tiempo.
Segun la orientacion del profesor jose ramon martinez batlle. para realizar este proyecto primero debemos generar una superficie continua usando los datos de lluvia y la capa de provincia y combinando las diferentes lineas de codigos aprendidas durante el desarrollo de esta materia. al final para general el mapa de isoyetas bastara con ejecutar el paquete contour data. disponible para R. y realisar algunos ajustes para la presentacion del mapa.
sf, la colección tidyverse y los paquetes spdep, lmtest, tmap y RColorBrewer en la primera parte de este proyecto, solo queda cargar el paquete gstat.library(gstat)
## Registered S3 method overwritten by 'xts':
## method from
## as.zoo.xts zoo
rutapre <- 'material-de-apoyo-master/data/onamet_prec_anual_sf.gpkg'
rutadiv <- 'material-de-apoyo-master/data/divisionRD.gpkg'
pre <- st_read(rutapre)
## Reading layer `onamet_prec_anual_sf' from data source `/home/franc/unidad-0-asignacion-99-mi-proyecto-Adalbertogp2020/material-de-apoyo-master/data/onamet_prec_anual_sf.gpkg' using driver `GPKG'
## Simple feature collection with 25 features and 37 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: -71.7 ymin: 18.067 xmax: -68.367 ymax: 19.85
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
prov <- st_read(rutadiv, layer = 'PROVCenso2010')
## Reading layer `PROVCenso2010' from data source `/home/franc/unidad-0-asignacion-99-mi-proyecto-Adalbertogp2020/material-de-apoyo-master/data/divisionRD.gpkg' using driver `GPKG'
## Simple feature collection with 32 features and 4 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 182215.8 ymin: 1933532 xmax: 571365.3 ymax: 2205216
## epsg (SRID): 32619
## proj4string: +proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
st_crs(pre)
## Coordinate Reference System:
## EPSG: 4326
## proj4string: "+proj=longlat +datum=WGS84 +no_defs"
crsdestino <- 32619
preutm <- pre %>% st_transform(crs = crsdestino)
preutm
ahora vamos a construir los datos para el año 1998:
nrow(preutm)
## [1] 25
summary(preutm$a1998)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 684.6 1151.7 1580.5 1644.0 1987.7 3011.3 2
hist(preutm$a1998)
hist(log(preutm$a1998))
shapiro.test(preutm$a1998)
##
## Shapiro-Wilk normality test
##
## data: preutm$a1998
## W = 0.94806, p-value = 0.2666
shapiro.test(log(pre$a1998))
##
## Shapiro-Wilk normality test
##
## data: log(pre$a1998)
## W = 0.97788, p-value = 0.8671
Segun el histograma los datos siguen distribución normal para la variable modificada, Igualmente, de los 25 pluviometros que teniamos en el pais para le año 1998 hay dos con datos perdidos (NA). Eliminemos dichos datos, y crearemos solo los obejtos de 1998 que tengan datos:
pre1998 <- na.omit(preutm[,c('Estación', 'a1998')])
pre1998$a1998log <- log(pre1998$a1998)
pre1998
library(ggplot2)
ggplot() +
geom_sf(data = prov, fill = 'white') +
geom_sf(data = pre1998, aes(col = a1998log), size = 6) +
scale_colour_gradient(low="#deebf7", high="#3182bd") +
geom_sf_text(data = prov, aes(label=TOPONIMIA), check_overlap = T, size = 2) +
geom_sf_text(data = pre1998, aes(label=Estación), check_overlap = T, size = 1.5) +
theme_bw()
Crearemos el variograma muestral para la variable modificada de la precipitación o sea la parte logaritmica.
f98 <- variogram(a1998log~1, pre1998)
f98
plot(f98, plot.numbers = T)
Después de construir el variograma muestral, vamos a construir un variograma modelo para esto utilizaremos la funcios Krige para interpolar los datos.
f98_m <- fit.variogram(f98, vgm(model = "Sph", range = 50000))
f98_m
plot(f98, f98_m, plot.numbers = T)
f98_m2 <- fit.variogram(f98, vgm(model = "Exp", range = 50000))
f98_m2
plot(f98, f98_m2, plot.numbers = T)
f98_m3 <- fit.variogram(f98, vgm(model = "Gau", range = 50000))
## Warning in fit.variogram(f98, vgm(model = "Gau", range = 50000)): No
## convergence after 200 iterations: try different initial values?
f98_m3
plot(f98, f98_m3, plot.numbers = T)
attr(f98_m, 'SSErr')
## [1] 5.877132e-11
attr(f98_m2, 'SSErr')
## [1] 5.93196e-11
attr(f98_m3, 'SSErr')
## [1] 6.080129e-11
Para esta interpolacion crearemos una cuadrícula con las precipitaciones. una cuadrícula apropiada para RD,seria una de baja resolución, por ejemplo 1x1km:
library(stars)
## Loading required package: abind
grd <- st_bbox(prov) %>%
st_as_stars(dx = 1000) %>%
st_set_crs(crsdestino) %>%
st_crop(prov)
grd
## stars object with 2 dimensions and 1 attribute
## attribute(s):
## values
## Min. :0
## 1st Qu.:0
## Median :0
## Mean :0
## 3rd Qu.:0
## Max. :0
## NA's :58017
## dimension(s):
## from to offset delta refsys point values
## x 1 390 182216 1000 +proj=utm +zone=19 +datum... NA NULL [x]
## y 1 272 2205216 -1000 +proj=utm +zone=19 +datum... NA NULL [y]
plot(grd)
Sobre esta superficie continua la cual es parte de nuestro objetivo principal para lo que queremos lograr mas adelante , ejecutamos la interpolación por kriging ordinario.
k <- krige(formula = a1998log~1, locations = pre1998, newdata = grd, model = f98_m2)
## [using ordinary kriging]
k
## stars object with 2 dimensions and 2 attributes
## attribute(s):
## var1.pred var1.var
## Min. :6.57 Min. :0.00
## 1st Qu.:7.33 1st Qu.:0.11
## Median :7.33 Median :0.11
## Mean :7.33 Mean :0.11
## 3rd Qu.:7.33 3rd Qu.:0.11
## Max. :7.96 Max. :0.11
## NA's :58017 NA's :58017
## dimension(s):
## from to offset delta refsys point values
## x 1 390 182216 1000 +proj=utm +zone=19 +datum... NA NULL [x]
## y 1 272 2205216 -1000 +proj=utm +zone=19 +datum... NA NULL [y]
plot(k)
summary(exp(as.vector(k$var1.pred)))
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 711.5 1525.8 1527.5 1530.1 1530.7 2862.7 58017
plot(raster::raster('kriging.tif'))
plot(raster::rasterToContour(exp(raster::raster('kriging.tif')), levels =seq(600,3000,100)), add=T)
ggplot() +
geom_stars(data = k, aes(fill = exp(var1.pred), x = x, y = y)) +
scale_fill_gradient(low="#deebf7", high="#3182bd", trans='log1p') +
geom_sf(data = st_cast(prov, "MULTILINESTRING")) +
geom_sf(data = pre1998) +
geom_sf_text(data = prov, aes(label=TOPONIMIA), check_overlap = T, size = 2) +
theme_bw()
Mediante el procedimiento utilizado para hacer los analisis de datos puntuales y geoestadistica, aprendimos a modelisar variogramas muestrales visualizando el comportamiento de homogeneidad de los datos de precipitacion para el año 1998. generamos el kriging ordinario para luego obtener una superficie continua. la cual nos da la posibilidad de crear un mapa de curvas de lluvias o mejor dicho mapa de isoyetas. al final de este proyecto pudimos
Codigos, procedimientos de la clase de superficie continua del profesor Jose Ramon Martinez Batlle.
Material de apoyo, suministrado por el profesor Jose Ramon Martinez Batlle. Capa de division de Provincia de La ONE. (Oficina Nacional de Estadisticas) Datos de lluvia ONAMET.(Oficina Nacional de Meteorologia)
Los datos son, como ya sabemos, una parte imprescindible del SIG, ya que sin ellos las aplicaciones SIG y los restantes elementos que se encuentran en torno a estas no tienen utilidad alguna. Necesitamos conocer el área geográfica que estudiamos en un SIG (es decir, tener datos sobre ella), para así poder proceder a dicho estudio.
No obstante, convertir esa área geográfica y la información acerca de ella en un dato susceptible de ser incorporado a un SIG no resulta una tarea sencilla. Desde los orígenes de los SIG, una de las preocupaciones principales ha sido la de representar de la mejor manera posible toda la información que podemos extraer de una zona geográfica dada, de tal modo que pueda almacenarse y analizarse en el entorno de un SIG. Este proceso de representación, que ya desde el inicio planteaba problemas a los creadores de los primeros SIG, ha sido el responsable en gran medida de la arquitectura y forma de los SIG actuales, y a él se debe en buena parte el desarrollo que han experimentado tanto los SIG en sí como las disciplinas afines.
El objetivo de este proyecto es modelizacion de datos espaciales,Establecimiento de un modelo geográfico. Es decir, un modelo conceptual de la realidad geográfica y su comportamiento. Establecimiento de un modelo de representación. Es decir, una forma de recoger el anterior modelo conceptual y sus características propias, reduciéndolo a una serie finita de elementos. Establecimiento de un modelo de almacenamiento. Es decir, un esquema de cómo almacenar los distintos elementos del modelo de representación.. En el presente analisis evaluaremos la autocorrelacion espacial global usaremos los criterios de shapiro wilk, Breusch-Pagan test y el I de Moran. crearemos un lineal común, utilizando la version original de la variable, analizaremos el criterio de homocedasticidad.
sf, la colección tidyverse y los paquetes spdep, lmtest, tmap y RColorBrewer en la primera parte de este proyecto, solo queda cargar el paquete lisacluster.Rsource('lisaclusters.R')
.RDS), asignándolo al objeto al19. tenemos un campo mediante el cual podemos hacer un enlace con la tabla, este seria el campo ENLACE, la misma se encuentra dividida por provincias y municipios. también usaremos la capa geométrica (.gpkg) asignándola al objeto mun, y la misma sera unida al objeto ad19. Ambas se encuentran en la carpeta data. verificaremos si hay inconsistencia en el código entre ambas fuentes.setwd("~/unidad-0-asignacion-99-mi-proyecto-Adalbertogp2020/material-de-apoyo-master/data")
munad19 <- readRDS('vivpersgeom_sf.RDS')
crsdestino <- 32619
munutm <- munad19 %>% st_transform(crs = crsdestino)
munutm
Para nuestro proyecto exploraremos el grado de asociación entre las diferentes variables de la tabla viviendas por perosnas y la haremos a nivel municipal como una forma de simplificar los calculos, nuestra variable dependiente sera la Categoría Ocupacional: Cesante
Población total Categoría Ocupacional: Cesante Tipo de vivienda: Casa independiente Tipo de vivienda: Apartamento Sexo: Hombres Sexo: Mujeres Cantidad Cuartos tiene la vivienda: 1 Cantidad Hogares en la vivienda: 1 Acceso a las viviendas del segmento: Calle asfaltadas Acceso a las viviendas del segmento: Callejon Principal medio de transporte utilizado por hogares del segmento: Guagua publica Cual es la relacion o parentesco con la jefa o el jefe del hogar: No pariente
Primero hecemos las selecciones correspondinetes ,cargamos el archivo objetos_para_modelizacion.RData y las variables le atribuimos nombres cortos conservando el campo ENLACE:
Magdal <- munutm %>% dplyr::select(
POBLACIONTOTAL = `Población total`,
CATEGOCUPCESANTE = `Categoría Ocupacional: Cesante`,
ENLACE = ENLACE,
TOPONIMIA = TOPONIMIA,
TIPOVIVIENDA = `Tipo de vivienda: Casa independiente`,
TIPOAARTAMENTO = `Tipo de vivienda: Apartamento`,
SEXOHOMBRE = `Sexo: Hombres`,
SEXOMUJERE = `Sexo: Mujeres`,
CANTIDADCUARTOS = `Cantidad Cuartos tiene la vivienda: 1`,
CANTIDADHOGARES = `Cantidad Hogares en la vivienda: 1`,
ACCESOVIVIENDA = `Acceso a las viviendas del segmento: Calle asfaltadas`,
ACCESOCALLEJON = `Acceso a las viviendas del segmento: Callejón`,
TRANSPORTEPRINCIPAL = `Principal medio de transporte utilizado por hogares del segmento: Guagua pública`,
PARENTESCO = `Cuál es la relación o parentesco con la jefa o el jefe del hogar: No pariente` )
Magdal.sp <- as_Spatial(Magdal)
row.names(Magdal.sp) <- as.character(Magdal.sp$TOPONIMIA)
Magdal.sp
## class : SpatialPolygonsDataFrame
## features : 155
## extent : 182215.8, 571365.3, 1933532, 2205216 (xmin, xmax, ymin, ymax)
## crs : +proj=utm +zone=19 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
## variables : 14
## names : POBLACIONTOTAL, CATEGOCUPCESANTE, ENLACE, TOPONIMIA, TIPOVIVIENDA, TIPOAARTAMENTO, SEXOHOMBRE, SEXOMUJERE, CANTIDADCUARTOS, CANTIDADHOGARES, ACCESOVIVIENDA, ACCESOCALLEJON, TRANSPORTEPRINCIPAL, PARENTESCO
## min values : 3641, 16, 010901, ALTAMIRA, 1087, 0, 1894, 1747, 17, 977, 0, 0, 0, 25
## max values : 965040, 19073, 103207, YAMASÁ, 214890, 103202, 460903, 504137, 29174, 287798, 239365, 46604, 138480, 12315
Magdal.nb <- poly2nb(Magdal.sp, queen=TRUE)
summary(Magdal.nb)
## Neighbour list object:
## Number of regions: 155
## Number of nonzero links: 804
## Percentage nonzero weights: 3.346514
## Average number of links: 5.187097
## Link number distribution:
##
## 1 2 3 4 5 6 7 8 9 10 11 12 14
## 1 10 20 34 33 22 13 13 4 1 1 2 1
## 1 least connected region:
## JUAN DE HERRERA with 1 link
## 1 most connected region:
## LA VEGA with 14 links
Conversion a un objeto sf.
plot(Magdal.sp, border="grey", lwd=0.5)
plot(Magdal.nb, coordinates(Magdal.sp), add=T)
Magdal.w.W <- nb2listw(Magdal.nb)
Magdal.w.W
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 155
## Number of nonzero links: 804
## Percentage nonzero weights: 3.346514
## Average number of links: 5.187097
##
## Weights style: W
## Weights constants summary:
## n nn S0 S1 S2
## W 155 24025 155 65.94606 650.7687
Magdal.w.B <- nb2listw(Magdal.nb, style = 'B')
Magdal.w.B
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 155
## Number of nonzero links: 804
## Percentage nonzero weights: 3.346514
## Average number of links: 5.187097
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 155 24025 804 1608 19520
*Con la funcion tidyverse, generamos una columna de porcentaje respecto del tamaño de la muestra a nivel municipal (columna Población total). le Pondremos por nombre adavariable_pct. luego Haremos una transformada a partir de la anterior, y le pondremos el nombre de la muestra a nivel municipal (columnaPoblación total). le Pondremos por nombreadavariable_pct_log. El objetosfresultante se asígnara aMagdal_adavar_sf`
Magdal_adavar <- Magdal %>%
st_centroid() %>%
select(ENLACE, CATEGOCUPCESANTE, POBLACIONTOTAL) %>%
mutate('PCT_CATEGOCUPCESANTE' = CATEGOCUPCESANTE/POBLACIONTOTAL*100,
'PCT_CATEGOCUPCESANTE_LOG' = log1p(PCT_CATEGOCUPCESANTE/POBLACIONTOTAL*100),
x=unlist(map(geom,1)),
y=unlist(map(geom,2))) %>%
st_drop_geometry()
## Warning in st_centroid.sf(.): st_centroid assumes attributes are constant
## over geometries of x
Magdal_adavar_sf <- Magdal %>%
inner_join(Magdal_adavar, by = 'ENLACE') %>%
dplyr::select(contains('PCT_CATEGOCUPCESANTE'), x, y, ENLACE, TOPONIMIA)
p1 <- tm_shape(Magdal_adavar_sf) +
tm_fill(col = "PCT_CATEGOCUPCESANTE", style = 'jenks', palette = brewer.pal(9, name = 'Reds')) +
tm_borders(lwd = 0.5)
p2 <- tm_shape(Magdal_adavar_sf) +
tm_fill(col = "PCT_CATEGOCUPCESANTE_LOG", style = 'jenks',
palette = brewer.pal(9, name = 'Reds'), midpoint = NA) +
tm_borders(lwd = 0.5)
tmap_arrange(p1, p2)
Magdal_adavar_sf %>% st_drop_geometry() %>%
gather(variable, valor, -(x:TOPONIMIA)) %>%
ggplot() + aes(sample=valor) +
stat_qq() + stat_qq_line() + theme_bw() +
theme(text = element_text(size = 14)) +
facet_wrap(~variable, scales = 'free')
Magdal_adavar_sf %>% st_drop_geometry() %>%
gather(variable, valor, -(x:TOPONIMIA)) %>% group_by(variable) %>%
summarise(prueba_normalidad=shapiro.test(valor)$p.value)
Magdal_adavar_sf %>% lm(PCT_CATEGOCUPCESANTE~ x, .) %>% plot(3)
Magdal_adavar_sf %>% lm(PCT_CATEGOCUPCESANTE~ y, .) %>% plot(3)
Magdal_adavar_sf %>% lm(PCT_CATEGOCUPCESANTE~ x, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 0.011233, df = 1, p-value = 0.9156
Magdal_adavar_sf %>% lm(PCT_CATEGOCUPCESANTE~ y, .) %>% bptest()
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 5.3746, df = 1, p-value = 0.02043
I de Moran global
attr(Magdal.w.W$neighbours, "region.id")
## [1] "SANTO DOMINGO DE GUZMÁN" "AZUA"
## [3] "LAS CHARCAS" "LAS YAYAS DE VIAJAMA"
## [5] "PADRE LAS CASAS" "PERALTA"
## [7] "SABANA YEGUA" "PUEBLO VIEJO"
## [9] "TÁBARA ARRIBA" "GUAYABAL"
## [11] "ESTEBANÍA" "NEIBA"
## [13] "GALVÁN" "TAMAYO"
## [15] "VILLA JARAGUA" "LOS RÍOS"
## [17] "BARAHONA" "CABRAL"
## [19] "ENRIQUILLO" "PARAÍSO"
## [21] "VICENTE NOBLE" "EL PEÑÓN"
## [23] "LA CIÉNAGA" "FUNDACIÓN"
## [25] "LAS SALINAS" "POLO"
## [27] "JAQUIMEYES" "DAJABÓN"
## [29] "LOMA DE CABRERA" "PARTIDO"
## [31] "RESTAURACIÓN" "EL PINO"
## [33] "SAN FRANCISCO DE MACORÍS" "ARENOSO"
## [35] "CASTILLO" "PIMENTEL"
## [37] "VILLA RIVA" "LAS GUÁRANAS"
## [39] "EUGENIO MARÍA DE HOSTOS" "COMENDADOR"
## [41] "BÁNICA" "EL LLANO"
## [43] "HONDO VALLE" "PEDRO SANTANA"
## [45] "JUAN SANTIAGO" "EL SEIBO"
## [47] "MICHES" "MOCA"
## [49] "CAYETANO GERMOSÉN" "GASPAR HERNÁNDEZ"
## [51] "JAMAO AL NORTE" "JIMANÍ"
## [53] "DUVERGÉ" "LA DESCUBIERTA"
## [55] "POSTRER RÍO" "CRISTÓBAL"
## [57] "MELLA" "HIGÜEY"
## [59] "SAN RAFAEL DEL YUMA" "LA ROMANA"
## [61] "GUAYMATE" "VILLA HERMOSA"
## [63] "LA VEGA" "CONSTANZA"
## [65] "JARABACOA" "JIMA ABAJO"
## [67] "NAGUA" "CABRERA"
## [69] "EL FACTOR" "RÍO SAN JUAN"
## [71] "MONTE CRISTI" "CASTAÑUELAS"
## [73] "GUAYUBÍN" "LAS MATAS DE SANTA CRUZ"
## [75] "PEPILLO SALCEDO" "VILLA VÁSQUEZ"
## [77] "PEDERNALES" "OVIEDO"
## [79] "BANÍ" "NIZAO"
## [81] "PUERTO PLATA" "ALTAMIRA"
## [83] "GUANANICO" "IMBERT"
## [85] "LOS HIDALGOS" "LUPERÓN"
## [87] "SOSÚA" "VILLA ISABELA"
## [89] "VILLA MONTELLANO" "SALCEDO"
## [91] "TENARES" "VILLA TAPIA"
## [93] "SAMANÁ" "SÁNCHEZ"
## [95] "LAS TERRENAS" "SAN CRISTÓBAL"
## [97] "SABANA GRANDE DE PALENQUE" "BAJOS DE HAINA"
## [99] "CAMBITA GARABITOS" "VILLA ALTAGRACIA"
## [101] "YAGUATE" "SAN GREGORIO DE NIGUA"
## [103] "LOS CACAOS" "SAN JUAN"
## [105] "BOHECHÍO" "EL CERCADO"
## [107] "JUAN DE HERRERA" "LAS MATAS DE FARFÁN"
## [109] "VALLEJUELO" "SAN PEDRO DE MACORÍS"
## [111] "LOS LLANOS" "RAMÓN SANTANA"
## [113] "CONSUELO" "QUISQUEYA"
## [115] "GUAYACANES" "COTUÍ"
## [117] "CEVICOS" "FANTINO"
## [119] "LA MATA" "SANTIAGO"
## [121] "BISONÓ" "JÁNICO"
## [123] "LICEY AL MEDIO" "SAN JOSÉ DE LAS MATAS"
## [125] "TAMBORIL" "VILLA GONZÁLEZ"
## [127] "PUÑAL" "SABANA IGLESIA"
## [129] "SAN IGNACIO DE SABANETA" "VILLA LOS ALMÁCIGOS"
## [131] "MONCIÓN" "MAO"
## [133] "ESPERANZA" "LAGUNA SALADA"
## [135] "BONAO" "MAIMÓN"
## [137] "PIEDRA BLANCA" "MONTE PLATA"
## [139] "BAYAGUANA" "SABANA GRANDE DE BOYÁ"
## [141] "YAMASÁ" "PERALVILLO"
## [143] "HATO MAYOR" "SABANA DE LA MAR"
## [145] "EL VALLE" "SAN JOSÉ DE OCOA"
## [147] "SABANA LARGA" "RANCHO ARRIBA"
## [149] "SANTO DOMINGO ESTE" "SANTO DOMINGO OESTE"
## [151] "SANTO DOMINGO NORTE" "BOCA CHICA"
## [153] "SAN ANTONIO DE GUERRA" "LOS ALCARRIZOS"
## [155] "PEDRO BRAND"
Magdal_adavar_sf$TOPONIMIA
## [1] SANTO DOMINGO DE GUZMÁN AZUA
## [3] LAS CHARCAS LAS YAYAS DE VIAJAMA
## [5] PADRE LAS CASAS PERALTA
## [7] SABANA YEGUA PUEBLO VIEJO
## [9] TÁBARA ARRIBA GUAYABAL
## [11] ESTEBANÍA NEIBA
## [13] GALVÁN TAMAYO
## [15] VILLA JARAGUA LOS RÍOS
## [17] BARAHONA CABRAL
## [19] ENRIQUILLO PARAÍSO
## [21] VICENTE NOBLE EL PEÑÓN
## [23] LA CIÉNAGA FUNDACIÓN
## [25] LAS SALINAS POLO
## [27] JAQUIMEYES DAJABÓN
## [29] LOMA DE CABRERA PARTIDO
## [31] RESTAURACIÓN EL PINO
## [33] SAN FRANCISCO DE MACORÍS ARENOSO
## [35] CASTILLO PIMENTEL
## [37] VILLA RIVA LAS GUÁRANAS
## [39] EUGENIO MARÍA DE HOSTOS COMENDADOR
## [41] BÁNICA EL LLANO
## [43] HONDO VALLE PEDRO SANTANA
## [45] JUAN SANTIAGO EL SEIBO
## [47] MICHES MOCA
## [49] CAYETANO GERMOSÉN GASPAR HERNÁNDEZ
## [51] JAMAO AL NORTE JIMANÍ
## [53] DUVERGÉ LA DESCUBIERTA
## [55] POSTRER RÍO CRISTÓBAL
## [57] MELLA HIGÜEY
## [59] SAN RAFAEL DEL YUMA LA ROMANA
## [61] GUAYMATE VILLA HERMOSA
## [63] LA VEGA CONSTANZA
## [65] JARABACOA JIMA ABAJO
## [67] NAGUA CABRERA
## [69] EL FACTOR RÍO SAN JUAN
## [71] MONTE CRISTI CASTAÑUELAS
## [73] GUAYUBÍN LAS MATAS DE SANTA CRUZ
## [75] PEPILLO SALCEDO VILLA VÁSQUEZ
## [77] PEDERNALES OVIEDO
## [79] BANÍ NIZAO
## [81] PUERTO PLATA ALTAMIRA
## [83] GUANANICO IMBERT
## [85] LOS HIDALGOS LUPERÓN
## [87] SOSÚA VILLA ISABELA
## [89] VILLA MONTELLANO SALCEDO
## [91] TENARES VILLA TAPIA
## [93] SAMANÁ SÁNCHEZ
## [95] LAS TERRENAS SAN CRISTÓBAL
## [97] SABANA GRANDE DE PALENQUE BAJOS DE HAINA
## [99] CAMBITA GARABITOS VILLA ALTAGRACIA
## [101] YAGUATE SAN GREGORIO DE NIGUA
## [103] LOS CACAOS SAN JUAN
## [105] BOHECHÍO EL CERCADO
## [107] JUAN DE HERRERA LAS MATAS DE FARFÁN
## [109] VALLEJUELO SAN PEDRO DE MACORÍS
## [111] LOS LLANOS RAMÓN SANTANA
## [113] CONSUELO QUISQUEYA
## [115] GUAYACANES COTUÍ
## [117] CEVICOS FANTINO
## [119] LA MATA SANTIAGO
## [121] BISONÓ JÁNICO
## [123] LICEY AL MEDIO SAN JOSÉ DE LAS MATAS
## [125] TAMBORIL VILLA GONZÁLEZ
## [127] PUÑAL SABANA IGLESIA
## [129] SAN IGNACIO DE SABANETA VILLA LOS ALMÁCIGOS
## [131] MONCIÓN MAO
## [133] ESPERANZA LAGUNA SALADA
## [135] BONAO MAIMÓN
## [137] PIEDRA BLANCA MONTE PLATA
## [139] BAYAGUANA SABANA GRANDE DE BOYÁ
## [141] YAMASÁ PERALVILLO
## [143] HATO MAYOR SABANA DE LA MAR
## [145] EL VALLE SAN JOSÉ DE OCOA
## [147] SABANA LARGA RANCHO ARRIBA
## [149] SANTO DOMINGO ESTE SANTO DOMINGO OESTE
## [151] SANTO DOMINGO NORTE BOCA CHICA
## [153] SAN ANTONIO DE GUERRA LOS ALCARRIZOS
## [155] PEDRO BRAND
## 155 Levels: ALTAMIRA ARENOSO AZUA BAJOS DE HAINA BANÍ BÁNICA ... YAMASÁ
match(attr(Magdal.w.W$neighbours, "region.id"), Magdal_adavar_sf$TOPONIMIA)==1:155
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [15] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [29] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [43] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [57] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [71] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [85] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [99] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [113] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [127] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [141] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [155] TRUE
(gmoranw <- moran.test(x = Magdal_adavar_sf$`PCT_CATEGOCUPCESANTE`, listw = Magdal.w.W))
##
## Moran I test under randomisation
##
## data: Magdal_adavar_sf$PCT_CATEGOCUPCESANTE
## weights: Magdal.w.W
##
## Moran I statistic standard deviate = 4.6586, p-value = 1.592e-06
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic Expectation Variance
## 0.233348721 -0.006493506 0.002650630
1-Para los pesos estandarizados=el valor de p obtenido fue menor de 0.05, hay evidencia preliminar para rechazar la hipótesis nula de " hay autocorrelación espacial“, y por lo tanto concluir que”si hay autocorrelación espacial de la variable Porcentage de personas con categoria ocupacional cesante“.
I de Moran local
moran.plot(x = Magdal_adavar_sf$PCT_CATEGOCUPCESANTE, listw = Magdal.w.W)
lisamap(objesp = Magdal_adavar_sf,
var = 'PCT_CATEGOCUPCESANTE',
pesos = Magdal.w.W,
tituloleyenda = 'Significancia\n("x-y", léase\ncomo "x"\nrodeado de "y"',
leyenda = T,
anchuratitulo = 50,
tamanotitulo = 16,
fuentedatos = 'ONE,2012',
titulomapa = paste0('Clusters LISA de respuestas a la pregunta:\n"','Porcentaje de personas en Categoría Ocupacional: Cesante', '"'))
## $grafico
##
## $objeto
## Simple feature collection with 155 features and 9 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 182215.8 ymin: 1933532 xmax: 571365.3 ymax: 2205216
## epsg (SRID): 32619
## proj4string: +proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
## First 10 features:
## PCT_CATEGOCUPCESANTE PCT_CATEGOCUPCESANTE_LOG x y ENLACE
## 1 1.8230332 0.0001888897 400576.8 2044091 100101
## 2 1.7373693 0.0019001797 308829.1 2037708 050201
## 3 1.3430579 0.0118749384 336675.2 2034232 050202
## 4 1.4358683 0.0081160580 289007.6 2058192 050203
## 5 1.6266653 0.0080839243 298570.6 2080773 050204
## 6 1.0159271 0.0066366890 311899.8 2057722 050205
## 7 1.8980021 0.0099295193 300563.9 2037000 050206
## 8 1.6644415 0.0147061214 311931.4 2034599 050207
## 9 0.7536692 0.0042617122 297803.0 2046138 050208
## 10 2.9640889 0.0547905819 313902.6 2070484 050209
## TOPONIMIA geom puntuacionz
## 1 SANTO DOMINGO DE GUZMÁN MULTIPOLYGON (((405218.1 20... 0.12154839
## 2 AZUA MULTIPOLYGON (((319065.3 20... -0.05743615
## 3 LAS CHARCAS MULTIPOLYGON (((341415.3 20... -0.88130269
## 4 LAS YAYAS DE VIAJAMA MULTIPOLYGON (((304058.1 20... -0.68738639
## 5 PADRE LAS CASAS MULTIPOLYGON (((312890.8 20... -0.28873887
## 6 PERALTA MULTIPOLYGON (((317370.6 20... -1.56480334
## 7 SABANA YEGUA MULTIPOLYGON (((306745.8 20... 0.27818686
## 8 PUEBLO VIEJO MULTIPOLYGON (((310447.9 20... -0.20981014
## 9 TÁBARA ARRIBA MULTIPOLYGON (((306556.7 20... -2.11275994
## 10 GUAYABAL MULTIPOLYGON (((322129.5 20... 2.50564778
## lagpuntuacionz quad_sig
## 1 0.77651749 not signif.
## 2 -0.65999052 not signif.
## 3 -0.32932976 not signif.
## 4 -0.58605508 not signif.
## 5 0.01924314 not signif.
## 6 -0.35707263 not signif.
## 7 -0.79333541 not signif.
## 8 0.11037536 not signif.
## 9 -0.16333686 not signif.
## 10 -0.57518286 not signif.
1-HAY Un patrón de varias provincias coloreadas de rojo se atribuye a “efecto de contagio” importante. esto siginifica que hay autocorrelación espacial local
2-el las demas provincias se observa el gris siginifica que no hay autocorrelación espacial local
3-En las demas provincias se observa el gris siginifica que no hay autocorrelación espacial local
POB19 <- Magdal %>%
mutate_each(funs(PCT=round(./POBLACIONTOTAL,4)*100), -ENLACE, -TOPONIMIA, -geom) %>% select(matches('_PCT$'))
## Warning: funs() is soft deprecated as of dplyr 0.8.0
## Please use a list of either functions or lambdas:
##
## # Simple named list:
## list(mean = mean, median = median)
##
## # Auto named with `tibble::lst()`:
## tibble::lst(mean, median)
##
## # Using lambdas
## list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once per session.
Modelo lineal común, utilizando la version original de la variables, analizemos el criterio de homocedasticidad:
Modlin <-POB19 %>% st_drop_geometry() %>% lm(CATEGOCUPCESANTE_PCT ~ ., data = .)
POB19 %>% summary
## POBLACIONTOTAL_PCT CATEGOCUPCESANTE_PCT TIPOVIVIENDA_PCT
## Min. :100 Min. :0.400 Min. :19.25
## 1st Qu.:100 1st Qu.:1.470 1st Qu.:25.95
## Median :100 Median :1.760 Median :28.96
## Mean :100 Mean :1.765 Mean :28.70
## 3rd Qu.:100 3rd Qu.:2.120 3rd Qu.:31.25
## Max. :100 Max. :2.960 Max. :36.38
## TIPOAARTAMENTO_PCT SEXOHOMBRE_PCT SEXOMUJERE_PCT CANTIDADCUARTOS_PCT
## Min. : 0.0000 Min. :47.76 Min. :40.75 Min. :0.390
## 1st Qu.: 0.0400 1st Qu.:50.67 1st Qu.:46.90 1st Qu.:1.325
## Median : 0.3800 Median :52.02 Median :47.98 Median :1.890
## Mean : 0.8935 Mean :52.10 Mean :47.90 Mean :2.333
## 3rd Qu.: 0.7700 3rd Qu.:53.10 3rd Qu.:49.33 3rd Qu.:2.780
## Max. :10.6900 Max. :59.25 Max. :52.24 Max. :9.900
## CANTIDADHOGARES_PCT ACCESOVIVIENDA_PCT ACCESOCALLEJON_PCT
## Min. :20.24 Min. : 0.000 Min. :0.000
## 1st Qu.:26.27 1st Qu.: 6.105 1st Qu.:0.625
## Median :27.62 Median : 9.670 Median :2.190
## Mean :27.55 Mean :10.280 Mean :2.544
## 3rd Qu.:29.19 3rd Qu.:14.010 3rd Qu.:3.730
## Max. :32.18 Max. :28.670 Max. :9.940
## TRANSPORTEPRINCIPAL_PCT PARENTESCO_PCT geom
## Min. : 0.000 Min. :0.340 MULTIPOLYGON :155
## 1st Qu.: 2.055 1st Qu.:0.870 epsg:32619 : 0
## Median : 4.240 Median :1.150 +proj=utm ...: 0
## Mean : 6.111 Mean :1.369
## 3rd Qu.: 8.795 3rd Qu.:1.565
## Max. :25.760 Max. :5.530
Modlin %>% bptest #Breusch-Pagan test
##
## studentized Breusch-Pagan test
##
## data: .
## BP = 24.048, df = 9, p-value = 0.004226
Interpretacion.
No es homocedastico
sar <- POB19 %>% select(contains('_PCT')) %>%
st_drop_geometry() %>%
spautolm(
formula = CATEGOCUPCESANTE_PCT ~ .,
data = .,
listw = Magdal.w.W)
## Warning: Function spautolm moved to the spatialreg package
## Warning in spautolm(formula = CATEGOCUPCESANTE_PCT ~ ., data = ., listw =
## Magdal.w.W): install the spatialreg package
## Warning: Function can.be.simmed moved to the spatialreg package
## Warning in can.be.simmed(listw): install the spatialreg package
## Warning: Function as_dgRMatrix_listw moved to the spatialreg package
## Warning in as_dgRMatrix_listw(from): install the spatialreg package
## Warning: Function as_dsCMatrix_I moved to the spatialreg package
## Warning in as_dsCMatrix_I(n): install the spatialreg package
## Warning: Function jacobianSetup moved to the spatialreg package
## Warning in jacobianSetup(method, env, con, pre_eig = con$pre_eig, trs =
## trs, : install the spatialreg package
## Warning: Function eigen_setup moved to the spatialreg package
## Warning in eigen_setup(env, which = which): install the spatialreg package
## Warning: Function as_dgRMatrix_listw moved to the spatialreg package
## Warning in as_dgRMatrix_listw(from): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
summary(sar)
## Warning: Method summary.spautolm moved to the spatialreg package
## Warning in summary.spautolm(sar): install the spatialreg package
## Warning: Method LR1.spautolm moved to the spatialreg package
## Warning in LR1.spautolm(object): install the spatialreg package
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(object): install the spatialreg package
## Warning: Method print.summary.spautolm moved to the spatialreg package
## Warning in print.summary.spautolm(x): install the spatialreg package
##
## Call:
## spautolm(formula = CATEGOCUPCESANTE_PCT ~ ., data = ., listw = Magdal.w.W)
##
## Residuals:
## Warning: Method residuals.spautolm moved to the spatialreg package
## Warning in residuals.spautolm(x): install the spatialreg package
## Min 1Q Median 3Q Max
## -1.04873 -0.26384 -0.01547 0.25669 1.36709
##
## Coefficients:
## (2 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.5558192 1.4233838 0.3905 0.69617
## POBLACIONTOTAL_PCT NA NA NA NA
## TIPOVIVIENDA_PCT 0.0016930 0.0188428 0.0898 0.92841
## TIPOAARTAMENTO_PCT 0.0587764 0.0300015 1.9591 0.05010
## SEXOHOMBRE_PCT -0.0145143 0.0276271 -0.5254 0.59933
## SEXOMUJERE_PCT NA NA NA NA
## CANTIDADCUARTOS_PCT -0.0304077 0.0315122 -0.9649 0.33457
## CANTIDADHOGARES_PCT 0.0778758 0.0314904 2.4730 0.01340
## ACCESOVIVIENDA_PCT -0.0019639 0.0054580 -0.3598 0.71898
## ACCESOCALLEJON_PCT -0.0114675 0.0157408 -0.7285 0.46630
## TRANSPORTEPRINCIPAL_PCT -0.0105590 0.0058618 -1.8013 0.07165
## PARENTESCO_PCT -0.0648452 0.0607801 -1.0669 0.28603
##
## Lambda: 0.2862 LR test value: 5.8247 p-value: 0.015803
## Numerical Hessian standard error of lambda: 0.11323
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(x): install the spatialreg package
##
## Log likelihood: -77.23856
## ML residual variance (sigma squared): 0.15591, (sigma: 0.39485)
## Number of observations: 155
## Number of parameters estimated: 12
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(object): install the spatialreg package
## AIC: 178.48
sar2 <- POB19 %>% select(contains('_PCT')) %>%
st_drop_geometry() %>%
spautolm(
formula = CATEGOCUPCESANTE_PCT ~ TRANSPORTEPRINCIPAL_PCT + TIPOAARTAMENTO_PCT ,
data = .,
listw = Magdal.w.W)
## Warning: Function spautolm moved to the spatialreg package
## Warning in spautolm(formula = CATEGOCUPCESANTE_PCT ~
## TRANSPORTEPRINCIPAL_PCT + : install the spatialreg package
## Warning: Function can.be.simmed moved to the spatialreg package
## Warning in can.be.simmed(listw): install the spatialreg package
## Warning: Function as_dgRMatrix_listw moved to the spatialreg package
## Warning in as_dgRMatrix_listw(from): install the spatialreg package
## Warning: Function as_dsCMatrix_I moved to the spatialreg package
## Warning in as_dsCMatrix_I(n): install the spatialreg package
## Warning: Function jacobianSetup moved to the spatialreg package
## Warning in jacobianSetup(method, env, con, pre_eig = con$pre_eig, trs =
## trs, : install the spatialreg package
## Warning: Function eigen_setup moved to the spatialreg package
## Warning in eigen_setup(env, which = which): install the spatialreg package
## Warning: Function as_dgRMatrix_listw moved to the spatialreg package
## Warning in as_dgRMatrix_listw(from): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
## Warning: Function do_ldet moved to the spatialreg package
## Warning in do_ldet(lambda, env): install the spatialreg package
summary(sar2)
## Warning: Method summary.spautolm moved to the spatialreg package
## Warning in summary.spautolm(sar2): install the spatialreg package
## Warning: Method LR1.spautolm moved to the spatialreg package
## Warning in LR1.spautolm(object): install the spatialreg package
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(object): install the spatialreg package
## Warning: Method print.summary.spautolm moved to the spatialreg package
## Warning in print.summary.spautolm(x): install the spatialreg package
##
## Call: spautolm(formula = CATEGOCUPCESANTE_PCT ~ TRANSPORTEPRINCIPAL_PCT +
## TIPOAARTAMENTO_PCT, data = ., listw = Magdal.w.W)
##
## Residuals:
## Warning: Method residuals.spautolm moved to the spatialreg package
## Warning in residuals.spautolm(x): install the spatialreg package
## Min 1Q Median 3Q Max
## -1.269299 -0.255063 0.016501 0.295159 1.340377
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.7826856 0.0688650 25.8867 < 2.2e-16
## TRANSPORTEPRINCIPAL_PCT -0.0118790 0.0061603 -1.9283 0.053814
## TIPOAARTAMENTO_PCT 0.0765833 0.0218658 3.5024 0.000461
##
## Lambda: 0.3683 LR test value: 12.19 p-value: 0.00048036
## Numerical Hessian standard error of lambda: 0.098742
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(x): install the spatialreg package
##
## Log likelihood: -90.3249
## ML residual variance (sigma squared): 0.18235, (sigma: 0.42703)
## Number of observations: 155
## Number of parameters estimated: 5
## Warning: Method logLik.spautolm moved to the spatialreg package
## Warning in logLik.spautolm(object): install the spatialreg package
## AIC: 190.65
De acuerdo con nuestra variable dependiente de la “Categoría Ocupacional: Cesante” los resultados obtenidos mediante las pruebas de autocorrelacion pudimos probar que en algunas provincias hay un patron de relleno rojo y azul de acuerdo con el mapa lisa cluster, significa que existe autocorrelación espacial global y un efecto de contagio importante en el desempleo. no obstante en las demas provincias se observa el color gris siginifica que no hay autocorrelación espacial global
Continuando con el analisis de modelizacion espacial global mediante las pruebas sar. solo dos variables resultaron significativas con relacion a la Categoría Ocupacional: Cesante
TRANSPORTEPRINCIPAL_PCT -0.0105590 0.0058618 -1.8013 0.07165
Con un valor cercano al 0.05 y en negativo la variable “Principal medio de transporte utilizado por hogares del segmento: Guagua pública” nos indica que cuando la categoria ocupacional cesante disminuye, el transporte principal utilizado aumenta.
TIPOAARTAMENTO_PCT 0.0587764 0.0300015 1.9591 0.05010
Con un valor de 0.05 y en positivo la variable “Tipo de vivienda: Apartamento” nos indica que cuando la categoria ocupacional cesante aumenta el Tipo de vivienda Apartamento disminuye
Los encargados de la planificación territorial se enfrentan al problema de manejar una gran cantidad de información espacial que les permita cumplir su labor en forma oportuna y satisfactoria. La presente investigación plantea una metodología basada en la integración de la Geomática y las Técnicas de Evaluación Multicriterio (EMC) para obtener un modelo de capacidad de acogida que facilite la correlacion de muchas variables que estan presente en el dia a dia de nuestra sociedad especificamente para la clase de nivel Bajo. en nuestro analisis usamos la variable original. mediante la prueva de Shapiro-Wilk, y el I de moran pudimos establecer los criterios para cada prueba descritos mas arriba.
Codigos, procedimientos de la clase de Vecindad, autocorrelacion espacial y modelizacion del profesor Jose Ramon Martinez Batlle.
Material de apoyo, suministrado por el profesor Jose Ramon Martinez Batlle. Capa de division de Provincia de La ONE. (Oficina Nacional de Estadisticas) Encuesta vivpersgeom 2011 de la ONE.(Oficina Nacional de Estadisticas) Capa de ProvCenso2010 de la ONE.(Oficina Nacional de Estadisticas).